package com.ymm.system.core.jobs;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.ymm.system.api.constants.TradeEntity;
import com.ymm.system.api.facade.SystemShipperCargoService;
import com.ymm.system.dao.mapper.TradeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.Date;

/**
 * @auther ZhangHongyuan
 * @date 2022/8/12 16:15
 */

@Component
public class TestJobTask {

    @Autowired
    private SystemShipperCargoService systemShipperCargoService;

    @Resource
    private TradeMapper tradeMapper;

    @XxlJob("testTask")
    public ReturnT<String> testTask(String s) throws ParseException {
        TradeEntity tradeEntity = new TradeEntity();
        tradeEntity.setTradeId(Long.valueOf(0));
        tradeEntity.setDriverLocation("nanjing");
        tradeEntity.setTradeDriverState(0);
        tradeEntity.setTradeCreateTime(new Date());
        tradeEntity.setTradeUpdateTime(new Date());
        tradeMapper.insertNewTrade(tradeEntity);
        return ReturnT.SUCCESS;
    }

}
